<template>
  <div>

	

	

	<section class="featured-block text-center">
		<div class="container">

			<table>
					<tr >
						<td style="padding:5px;">
							
							商品名称:

						</td>
						<td style="padding:5px;">
							
							<input type="text" v-model="name" />

						</td>
					</tr>

					<tr>
						<td style="padding:5px;">
							
							商品标签:

						</td>
						<td style="padding:5px;">

							<TagInput v-model="mytags" type="string" split="," placeholder="请输入标签，输入完毕后按回车确认"></TagInput>

						</td>
					</tr>

					

					<tr>
						<td style="padding:5px;">
							

						</td>
						<td style="padding:5px;">
							
							<Button @click="submit" color="green">提交</Button> &nbsp;&nbsp;

						</td>
					</tr>

			</table>
			
			

		</div>
	</section>
	

	
	
	
	
    
  </div>
  
</template>


 
<script>

//导包

import dragVerify from 'vue-drag-verify';
import {config,formatXml} from '../config.js';

export default {
  data () {
    return {
      msg: "这是一个变量",
      //声明面包屑变量
     
	  name:'',
	  cate_id:1,
      //商品标签变量
      mytags:''
    }
  },
  //注册组件标签
  components:{
  		
  },
  mounted:function(){
 
  
  },
  methods:{
  	//提交
  	submit:function(){

    

      //发送请求
      this.axios.get('http://localhost:8000/insertgoods1/',{params:{name:this.name,cate_id:this.cate_id}}).then((result) =>{

              console.log(result);

              this.$Message(result.data.message);

              //只有商品入库成功，才添加标签

              //if(result.data.id){

              this.axios.get('http://localhost:8000/inserttags1/',{params:{id:result.data.id,tags:this.mytags}}).then((result) =>{

              console.log(result);
     		 });

             // }


      });





  	},

     
  }
}


</script>
 
<style>



</style>